from selenium import webdriver
# 导入显式等待
from selenium.webdriver.support import expected_conditions as EC
from selenium.webdriver.support.wait import WebDriverWait

driver = webdriver.Chrome()
driver.get("https://www.baidu.com")
# func = lambda x: True if x.title == '百度一下, 你就知道' else False
# print(func)
# 等待True 超时没有返回False,就抛出异常


# result1 = WebDriverWait(driver, 10).until(lambda x:True if x.title=='百度一下，你就知道' else False, message='标题不一致')
# print(result1)
# 等待False 超时没有返回False,就抛出异常
result2 = WebDriverWait(driver, 10).until_not(lambda x:True if x.title=='百度一下1，你就知道' else False, message='标题不一致')
print(result2)

driver.quit()